﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Webdiyer.AspNetCore;

namespace BlazorProject.Repository
{
    public interface IRepository<T> where T : class
    {
        T GetById(object id);
        T FirstOrDefault();
        T GetByExpression(Expression<Func<T, bool>> predicate);
        IEnumerable<T> GetList();
        IEnumerable<T> GetList(Expression<Func<T, bool>> predicate);
        int Count(Expression<Func<T, bool>> predicate);
        decimal Sum(Expression<Func<T, bool>> predicate, Expression<Func<T, decimal>> selector);
        PagedList<T> GetPagedList(int pageIndex, int pageSize, Expression<Func<T, bool>> predicate);
        bool Add(T entity);
        bool Add(List<T> entitys);
        bool Update(T entity);
        bool Update(List<T> entitys);
        bool Delete(string id);
        bool Delete(T entity);
        bool Delete(List<T> entitys);
        bool Delete(Expression<Func<T, bool>> predicate);
    }
}
